<!DOCTYPE html>
<html>
  <head>
    <title>Test CASE FOR TMP DIR SHOULD BE REMOVED AFTER APP EXIT</title>
  </head>
  <body>
    <h1>Hello World!</h1>
    <script>
      var gui = require('nw.gui');
      var path = require('path');
      var temp_dir_path = location.href;
      var fs = require('fs');
      var tmp_path = path.join(gui.App.argv[0], 'tmp-nw', 'path.org');

      fs.writeFile(tmp_path, temp_dir_path, function(err) {
	  if(err) {
	      console.log(err);
	  } else {
	      console.log("The file was saved!");
	      gui.App.quit();
	  }
      }); 
      
    </script>
  </body>
</html>
